package src.Aula08.Ex2;

public class AlimentoVegetariano extends Alimento {
    private String nome;

    public AlimentoVegetariano(String nome, double proteinas, double calorias, double peso) {
        super(proteinas, calorias, peso);
        this.nome = nome;
    }

    

    @Override
    public String toString() {
        return String.format("Alimento Vegetariano, proteinas %.2f, calorias %.2f, peso %.2f", getProteinas(), getCalorias(), getPeso());
    }



    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((nome == null) ? 0 : nome.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        AlimentoVegetariano other = (AlimentoVegetariano) obj;
        if (nome == null) {
            if (other.nome != null)
                return false;
        } else if (!nome.equals(other.nome))
            return false;
        return true;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

}
